var t = require;
var e = module;
var n = exports;
Object.defineProperty(n, "__esModule", {value: !0});
var o = t("BootConst"),
    r = (function () {
        function t() {}
        return (
            (t.init = function () {
                o.dd.使用微信自定义场景行为 &&
                    ("undefined" != typeof wx && wx.reportUserBehaviorBranchAnalytics
                        ? ((this.namesByBranchId = {}), (this.branchDimsByAdId = {}))
                        : (o.dd.使用微信自定义场景行为 = !1)),
                    o.dd.使用微信测速 &&
                        (("undefined" != typeof wx && wx.reportPerformance) || (o.dd.使用微信测速 = !1));
            }),
            (t.addAdIdBranchDims = function (t) {
                if (this.branchDimsByAdId)
                    for (var e = -1, n = 0, o = t; n < o.length; n++) {
                        var r = o[n];
                        e++,
                            this.branchDimsByAdId[r] > -1
                                ? console.error("重复的 adId：" + r)
                                : (this.branchDimsByAdId[r] = e);
                    }
            }),
            (t.branchId2name = function (t) {
                return (t && t._wx_branchIds && this.namesByBranchId[t._wx_branchIds[0]]) || "";
            }),
            (t.getBranchDimByName = function (t) {
                var e = this.azs.indexOf(t.charAt(0));
                return e > -1 ? e : 99;
            }),
            (t.getBranchDimByAdId = function (t) {
                if (this.branchDimsByAdId) {
                    var e = this.branchDimsByAdId[t];
                    if (e > -1) return e;
                    console.error("木有对应的 branchDim：" + t);
                }
                return 99;
            }),
            (t.getArgs = function (t, e) {
                var n = o.dd[t];
                if (n) {
                    var r = n[e];
                    if (r) {
                        if ("wx_branchId" in r) return r;
                        console.error(e + " 木有 wx_branchId" + t + " " + JSON.stringify(r));
                    }
                }
            }),
            (t.getAdShowArgs = function (t, e) {
                if (t)
                    return {
                        branchId: "string" == typeof t ? t : t._wx_branchIds ? t._wx_branchIds[0] : "",
                        branchDim: (this.getBranchDimByAdId(e) + 1).toString()
                    };
            }),
            (t.reportUserBehaviorBranchAnalytics = function (t, e, n) {
                void 0 === n && (n = 1),
                    o.dd.使用微信自定义场景行为 &&
                        (e > 0
                            ? wx.reportUserBehaviorBranchAnalytics({branchId: t, branchDim: e.toString(), eventType: n})
                            : wx.reportUserBehaviorBranchAnalytics({branchId: t, eventType: n}));
            }),
            (t.测速 = function (t) {
                o.dd.使用微信测速 && wx.reportPerformance(t, new Date().getTime() - window.startTime);
            }),
            (t.azs = [
                "a",
                "b",
                "c",
                "d",
                "e",
                "f",
                "g",
                "h",
                "i",
                "j",
                "k",
                "l",
                "m",
                "n",
                "o",
                "p",
                "q",
                "r",
                "s",
                "t",
                "u",
                "v",
                "w",
                "x",
                "y",
                "z",
                "A",
                "B",
                "C",
                "D",
                "E",
                "F",
                "G",
                "H",
                "I",
                "J",
                "K",
                "L",
                "M",
                "N",
                "O",
                "P",
                "Q",
                "R",
                "S",
                "T",
                "U",
                "V",
                "W",
                "X",
                "Y",
                "Z"
            ]),
            (t.测速s = {boot: 2001, loaded: 2002, menu: 2003}),
            t
        );
    })();
n.default = r;
